<template>
  <div>
    <a-row>
      <a-col :span="24">
        <div class="table-container">
          <!-- 查询区域 -->
          <div class="table-page-search-wrapper">
            <!-- 搜索区域 -->
            <a-form-model layout="inline" v-bind="searchModelConfig"
                          @keyup.enter.native="searchQuery">
              <a-row v-bind="searchRowConfig">
                <a-col :span="5">
                  <a-form-model-item>
                    <a-input v-model="queryParam.searchValue" placeholder="请输入客户名称/手机号">
                      <a-icon slot="prefix" class="font-placeholder" type="search" />
                    </a-input>
                  </a-form-model-item>
                </a-col>
                <a-col class="table-page-search-submitButtons" v-bind="searchColConfig">
                  <a-button @click="searchQuery" type="primary">查询</a-button>
                  <a-button @click="searchReset" type="danger">重置</a-button>
                </a-col>
              </a-row>
            </a-form-model>
          </div>

          <!-- table区域-begin -->
          <a-row>
            <a-col :span="24">
              <ry-table
                :columns="columns" :loading="loading" :data-source="dataSource"
                :rowKey="record=>record.id" :pagination="ipagination" bordered
                >
                <template slot="status" slot-scope="{text, record}">
                  <span v-if="record.status === 0">
                    <a-tag color="blue">待回复</a-tag>
                  </span>
                  <a-tag color="green" v-else>已回复</a-tag>
                </template>
                <template slot="action" slot-scope="{record}">
                  <a-space size="middle">
                    <a-tooltip title="编辑回复">
                      <a-button @click="handleEdit(record)" type="primary" v-has="['editReply']">编辑回复</a-button>
                    </a-tooltip>
                  </a-space>
                </template>
              </ry-table>
            </a-col>
          </a-row>
        </div>
      </a-col>
    </a-row>
    <MessageBoardModel ref="modalForm" @ok="modalFormOk" :url="url" />
  </div>
</template>

<script>
import { RyListMixin } from '@/ryweb'
import MessageBoardModel from './modules/MessageBoardModel.vue'
export default {
  name: '',
  mixins: [RyListMixin],
  components: {MessageBoardModel},
  data () {
    return {
      reloadDict: true,
      show: false,
      isShow: false,
      form: {},
      columns: [
        {
          title: '客户名称',
          align: 'center',
          dataIndex: 'businessAccount.nickname'
        },
        {
          title: '客户手机号',
          align: 'center',
          dataIndex: 'businessAccount.phone'
        },
        {
          title: '留言问题',
          align: 'center',
          ellipsis: true,
          dataIndex: 'question',
          width: 200
        },
        {
          title: '状态',
          align: 'center',
          dataIndex: 'status',
          scopedSlots: { customRender: 'status' }
        },
        {
          title: '留言时间',
          align: 'center',
          width: 200,
          dataIndex: 'createTime'
        },
        {
          title: '回复问题',
          align: 'center',
          dataIndex: 'answer',
          ellipsis: true,
          width: 200
        },
        {
          title: '回复人',
          align: 'center',
          dataIndex: 'updateBy'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: this.$api.permission.message.message,
        add: this.$api.permission.message.insert,
        edit: this.$api.permission.message.update
      }
    }
  },
  props: {
  },
  methods: {
    modalFormOk () {
      this.loadData()
    }
  },
  created () {
  },
  mounted () {
  }
}
</script>

<style lang="less">
#LabelInfoMaintain {
  border-left: 1px solid #f4f4f4;
}
.table-operator {
  display: flex;
  justify-content: space-between;
  align-content: center;
  .setting {
    margin-top: 5px;
    font-size: 16px;
    color: #00bbbb;
  }
}
.age_box {
  width: 100%;
  padding: 0;
  .ant-form-item {
    width: 100%;
    text-align: center;
  }
  .ant-input {
    width: 40%;
  }
}
.ant-col .ant-col-1 {
  padding: -12px;
}
.table-page-search-wrapper {
  margin-left: 0rem;
}
.table_headr {
  color: #000000;
  .labelSty {
    margin-right: 30px;
    font-size: 18px;
  }
  .ant-btn {
    text-align: center;
    background: #f2f2f2;
    color: #868686;
    border: 0;
  }
  .dataColor {
    color: #3ec2c9;
    padding: 0 10px 0 10px;
  }
  .table-search-wrapper {
    display: flex;
    justify-content: center;
    align-content: center;
    .ant-input {
      width: 100%;
    }
    .table-search-submitButtons {
      display: flex;
      justify-content: center;
      align-content: center;
      .ant-btn {
        background: #989eab;
        color: #fff;
        margin-right: 10px;
      }
      .ant-btn:first-child {
        background: #ffac54;
      }
    }
  }
}
</style>
